package com.ruirenyun.entity.base.resp;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @author Deng Ye
 * @version 1.0
 * @date 2020/11/23
 * @description
 * @modifiedBy
 */
@Getter
@Setter
@NoArgsConstructor
public class CommonRespVo<T> extends AbstractResponseVo{
    private static final long serialVersionUID = 8782135378535880585L;

    private String code;
    private String msg;
    private T data;

    public static <T> CommonRespVo<T> success(T data) {
        return new CommonRespVo<T>("SUCCESS", "操作成功", data);
    }

    public static <T> CommonRespVo<T> success() {
        return new CommonRespVo<T>("SUCCESS", "操作成功", null);
    }

    public static <T> CommonRespVo<T> other(String code, String msg, T data) {
        return new CommonRespVo<T>(code, msg, data);
    }

    public static <T> CommonRespVo<T> other(String code, String msg) {
        return new CommonRespVo<T>(code, msg);
    }

    public CommonRespVo(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public CommonRespVo(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
